﻿using Furion.DatabaseAccessor;
using Furion.DependencyInjection;
using FurionApi.Demo.Core;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FurionApi.Demo.Application.U_Test.Services
{
    public class UTestService : IUTestService, ITransient
    {
        private readonly IRepository<UTest> uTestRep;

        public UTestService(IRepository<UTest> _uTestRep) {
            uTestRep = _uTestRep;
        }
        public async Task<UTest> GetUTestAsync()
        {
            return await uTestRep.DetachedEntities.Where(b => b.Id == 1).FirstOrDefaultAsync();
        }

        public UTest GetUTest(int id)
        {
            return uTestRep.DetachedEntities.Where(b=>b.Id==id).SingleOrDefault();
        }
    }
}
